import Vue from 'vue'
import VueRouter from 'vue-router'
const reload = () => import('@/components/Login')
const layout = () => import('@/components/Index')
const main = () => import('@/components/Homepage/Homepage')
import SkipBlank from '../components/SkipBlank/SkipBlank.vue'
import CouponDetails from '../components/PromotionManagement/CouponDetails.vue'
import Add from '../components/PromotionManagement/ThematicManagement/add.vue'
import Edit from '../components/PromotionManagement/ThematicManagement/edie.vue'


// import Vue from 'vue'
// import Router from 'vue-router'
// const layout = () => import('@/components/Index')
// // 登录页
// const reload = () => import('@/components/Login')
// const main = () => import('@/components/Homepage/Homepage')


// const tree = () => import('@/views/example/tree')
// const table = () => import('@/views/example/table/index')
// const tableFirst = () => import('@/views/example/table/tableFirst')
// const tableSecond = () => import('@/views/example/table/tableSecond')
Vue.use(VueRouter)

// const originalPush = VueRouter.prototype.push
// VueRouter.prototype.push = function push(location) {
// 	return originalPush.call(this, location).catch(err => err)
// }


export const fixedRouter = [{
		path: '/',
		redredirect: '/login'
	},
	{
		path: '/Index',
		component: layout,
		children: [{
			path: 'main',
			component: main,
			meta: {
				title: '首页'
			}
		}, ],
	},
	{
		path: '/Index',
		component: layout,
		children: [{
			path: '/Index/CouponDetails',
			component: CouponDetails,
			meta: {
				title: '优惠券详情'
			}
		}, ]
	},
	{
		path: '/Index',
		component: layout,
		children: [{
			path: '/Index/Add',
			component: Add,
			meta: {
				title: '专题创建'
			}
		}, ]
	},
	{
		path: '/Index',
		component: layout,
		children: [{
			path: '/Index/Edit',
			component: Edit,
			meta: {
				title: '专题编辑'
			}
		}, ]
	},

	{
		path: "/login",
		component: reload
	},
	{
		path: '/SkipBlank',
		component: SkipBlank,
	},
	// {
	// 	path:'/CouponDetails',
	// 	component:CouponDetails,
	// }
]
export const permissionRouter = [{
		path: '/userManage',
		component: layout,
		redirect: 'noredirect',
		alwaysShow: true,
		name: 'userManage',
		meta: {
			title: '用户管理',
			icon: 'chart'
		},
		children: [{
				path: '/userManage/user',
				component: () => import('@/components/UserManagement/MultiplexRouting'),
				name: 'user',
				meta: {
					perms: ['GET /admin/user/list'],
					title: '会员管理',
					noCache: true
				}
			},
			{
				path: '/userManage/address',
				component: () => import('@/components/UserManagement/MultiplexRouting'),
				name: 'address',
				meta: {
					perms: ['GET /admin/address/list'],
					title: '收货地址',
					noCache: true
				}
			},
			{
				path: '/userManage/collect',
				component: () => import('@/components/UserManagement/MultiplexRouting'),
				name: 'collect',
				meta: {
					perms: ['GET /admin/collect/list'],
					title: '会员收藏',
					noCache: true
				}
			},
			{
				path: '/userManage/footprint',
				component: () => import('@/components/UserManagement/MultiplexRouting'),
				name: 'footprint',
				meta: {
					perms: ['GET /admin/footprint/list'],
					title: '会员足迹',
					noCache: true
				}
			},
			{
				path: '/userManage/history',
				component: () => import('@/components/UserManagement/MultiplexRouting'),
				name: 'history',
				meta: {
					perms: ['GET /admin/history/list'],
					title: '搜索历史',
					noCache: true
				}
			},
			{
				path: '/userManage/feedback',
				component: () => import('@/components/UserManagement/MultiplexRouting'),
				name: 'feedback',
				meta: {
					perms: ['GET /admin/feedback/list'],
					title: '意见反馈',
					noCache: true
				}
			}
		]
	},

	{
		path: '/MallManagement',
		component: layout,
		redirect: 'noredirect',
		alwaysShow: true,
		name: 'MallManagement',
		meta: {
			title: '商场管理',
			icon: 'chart'
		},
		children: [{
				path: '/MallManagement/MultiplexRouting',
				component: () => import('@/components/MallManagement/MultiplexRouting'),
				name: 'MultiplexRouting',
				meta: {
					title: '行政区域',
					noCache: true
				}
			},
			{
				path: '/MallManagement/brand',
				component: () => import('@/components/MallManagement/MultiplexRouting'),
				name: 'brand',
				meta: {
					perms: ['GET /admin/brand/list', 'POST /admin/brand/create',
						'GET /admin/brand/read',
						'POST /admin/brand/update', 'POST /admin/brand/delete'
					],
					title: '品牌制造商',
					noCache: true
				}
			},
			{
				path: '/MallManagement/category',
				component: () => import('@/components/MallManagement/CommodityCategory'),
				name: 'category',
				meta: {
					perms: ['GET /admin/category/list', 'POST /admin/category/create',
						'GET /admin/category/read', 'POST /admin/category/update',
						'POST /admin/category/delete'
					],
					title: '商品类目',
					noCache: true
				}
			},
			{
				path: '/MallManagement/order',
				component: () => import('@/components/MallManagement/OrderManagement'),
				name: 'order',
				meta: {
					perms: ['GET /admin/order/list', 'GET /admin/order/detail',
						'POST /admin/order/ship',
						'POST /admin/order/refund', 'POST /admin/order/delete',
						'POST /admin/order/reply'
					],
					title: '订单管理',
					noCache: true
				}
			},
			{
				path: '/MallManagement/aftersale',
				component: () => import('@/components/MallManagement/MultiplexRouting'),
				name: 'aftersale',
				meta: {
					perms: ['GET /admin/aftersale/list', 'GET /admin/aftersale/detail',
						'POST /admin/order/receive', 'POST /admin/aftersale/complete',
						'POST /admin/aftersale/reject'
					],
					title: '售后管理',
					noCache: true
				}
			},
			{
				path: '/MallManagement/issue',
				component: () => import('@/components/MallManagement/MultiplexRouting'),
				name: 'issue',
				meta: {
					perms: ['GET /admin/issue/list', 'POST /admin/issue/create',
						'GET /admin/issue/read',
						'POST /admin/issue/update', 'POST /admin/issue/delete'
					],
					title: '通用问题',
					noCache: true
				}
			},
			{
				path: '/MallManagement/keyword',
				component: () => import('@/components/MallManagement/MultiplexRouting'),
				name: 'keyword',
				meta: {
					perms: ['GET /admin/keyword/list', 'POST /admin/keyword/create',
						'GET /admin/keyword/read',
						'POST /admin/keyword/update', 'POST /admin/keyword/delete'
					],
					title: '关键词',
					noCache: true
				}
			}
		]
	},

	{
		path: '/goods',
		component: layout,
		redirect: 'noredirect',
		alwaysShow: true,
		name: 'goodsManage',
		meta: {
			title: '商品管理',
			icon: 'chart'
		},
		children: [{
				path: '/goods/list',
				component: () => import('@/components/CommodityManagement/ProductList'),
				name: 'goodsList',
				meta: {
					perms: ['GET /admin/goods/list', 'POST /admin/goods/delete'],
					title: '商品列表',
					noCache: true
				}
			},
			{
				path: '/goods/create',
				component: () => import('@/components/CommodityManagement/MultiplexRouting'),
				name: 'goodsCreate',
				meta: {
					perms: ['POST /admin/goods/create'],
					title: '商品上架',
					noCache: true
				}
			},
			{
				path: '/goods/edit',
				component: () => import('@/components/CommodityManagement/MultiplexRouting'),
				name: 'goodsEdit',
				meta: {
					perms: ['GET /admin/goods/detail', 'POST /admin/goods/update',
						'POST /admin/goods/catAndBrand'
					],
					title: '商品编辑',
					noCache: true
				},
				hidden: true
			},
			{
				path: '/goods/comment',
				component: () => import('@/components/CommodityManagement/CommodityReview'),
				name: 'goodsComment',
				meta: {
					perms: ['GET /admin/comment/list', 'POST /admin/comment/delete'],
					title: '商品评论',
					noCache: true
				}
			}
		]
	},
	{
		path: '/promotion',
		component: layout,
		redirect: 'noredirect',
		alwaysShow: true,
		name: 'promotionManage',
		meta: {
			title: '推广管理',
			icon: 'chart'
		},
		children: [{
				path: '/promotion/ad',
				component: () => import('@/components/PromotionManagement/AdvertisingManagement'),
				name: 'ad',
				meta: {
					perms: ['GET /admin/ad/list', 'POST /admin/ad/create', 'GET /admin/ad/read',
						'POST /admin/ad/update', 'POST /admin/ad/delete'
					],
					title: '广告管理',
					noCache: true
				}
			},
			{
				path: '/promotion/coupon',
				component: () => import('@/components/PromotionManagement/CouponManagement'),
				name: 'coupon',
				meta: {
					perms: ['GET /admin/coupon/list', 'POST /admin/coupon/create',
						'POST /admin/coupon/update',
						'POST /admin/coupon/delete'
					],
					title: '优惠券管理',
					noCache: true
				}
			},
			// {
			// 	path: '/promotion/couponDetail',
			// 	component: () => import('@/components/PromotionManagement/MultiplexRouting'),
			// 	name: 'couponDetail',
			// 	meta: {
			// 		perms: ['GET /admin/coupon/list', 'GET /admin/coupon/listuser'],
			// 		title: '优惠券详情',
			// 		noCache: true
			// 	},
			// 	hidden: true
			// },
			{
				path: '/promotion/topic',
				component: () => import('@/components/PromotionManagement/ThematicManagement'),
				name: 'topic',
				meta: {
					perms: ['GET /admin/topic/list', 'POST /admin/topic/create',
						'GET /admin/topic/read',
						'POST /admin/topic/update', 'POST /admin/topic/delete'
					],
					title: '专题管理',
					noCache: true
				}
			},
			// {
			// 	path: '/promotion/topic-create',
			// 	component: () => import('@/components/PromotionManagement/MultiplexRouting'),
			// 	name: 'topicCreate',
			// 	meta: {
			// 		perms: ['POST /admin/topic/create'],
			// 		title: '专题创建',
			// 		noCache: true
			// 	},
			// 	hidden: true
			// },
			// {
			// 	path: '/promotion/topic-edit',
			// 	component: () => import('@/components/PromotionManagement/MultiplexRouting'),
			// 	name: 'topicEdit',
			// 	meta: {
			// 		perms: ['GET /admin/topic/read', 'POST /admin/topic/update'],
			// 		title: '专题编辑',
			// 		noCache: true
			// 	},
			// 	hidden: true
			// },
			{
				path: '/promotion/groupon-rule',
				component: () => import('@/components/PromotionManagement/MultiplexRouting'),
				name: 'grouponRule',
				meta: {
					perms: ['GET /admin/groupon/list', 'POST /admin/groupon/create',
						'POST /admin/groupon/update', 'POST /admin/groupon/delete'
					],
					title: '团购规则',
					noCache: true
				}
			},
			{
				path: '/promotion/groupon-activity',
				component: () => import('@/components/PromotionManagement/MultiplexRouting'),
				name: 'grouponActivity',
				meta: {
					perms: ['GET /admin/groupon/listRecord'],
					title: '团购活动',
					noCache: true
				}
			}
		]
	},

	{
		path: '/sys',
		component: layout,
		redirect: 'noredirect',
		alwaysShow: true,
		name: 'sysManage',
		meta: {
			title: '系统管理',
			icon: 'chart'
		},
		children: [{
				path: '/sys/admin',
				component: () => import('@/components/SystemManagement/Administrators'),
				name: 'admin',
				meta: {
					perms: ['GET /admin/admin/list', 'POST /admin/admin/create',
						'POST /admin/admin/update',
						'POST /admin/admin/delete'
					],
					title: '管理员',
					noCache: true
				}
			},
			{
				path: '/sys/notice',
				component: () => import('@/components/SystemManagement/NotificatioManagement'),
				name: 'sysNotice',
				meta: {
					perms: ['GET /admin/notice/list', 'POST /admin/notice/create',
						'POST /admin/notice/update',
						'POST /admin/notice/delete'
					],
					title: '通知管理',
					noCache: true
				}
			},
			{
				path: '/sys/log',
				component: () => import('@/components/SystemManagement/MultiplexRouting'),
				name: 'log',
				meta: {
					perms: ['GET /admin/log/list'],
					title: '操作日志',
					noCache: true
				}
			},
			{
				path: '/sys/role',
				component: () => import('@/components/SystemManagement/RoleManagement'),
				name: 'role',
				meta: {
					perms: ['GET /admin/role/list', 'POST /admin/role/create',
						'POST /admin/role/update',
						'POST /admin/role/delete', 'GET /admin/role/permissions',
						'POST /admin/role/permissions'
					],
					title: '角色管理',
					noCache: true
				}
			},
			{
				path: '/sys/os',
				component: () => import('@/components/SystemManagement/MultiplexRouting'),
				name: 'os',
				meta: {
					perms: ['GET /admin/storage/list', 'POST /admin/storage/create',
						'POST /admin/storage/update', 'POST /admin/storage/delete'
					],
					title: '对象存储',
					noCache: true
				}
			}
		]
	},

	{
		path: '/config',
		component: layout,
		redirect: 'noredirect',
		alwaysShow: true,
		name: 'configManage',
		meta: {
			title: '配置管理',
			icon: 'chart'
		},
		children: [{
				path: '/config/mall',
				component: () => import('@/components/ConfigurationManagement/MultiplexRouting'),
				name: 'configMall',
				meta: {
					perms: ['GET /admin/config/mall', 'POST /admin/config/mall'],
					title: '商场配置',
					noCache: true
				}
			},
			{
				path: '/config/express',
				component: () => import('@/components/ConfigurationManagement/MultiplexRouting'),
				name: 'configExpress',
				meta: {
					perms: ['GET /admin/config/express', 'POST /admin/config/express'],
					title: '运费配置',
					noCache: true
				}
			},
			{
				path: '/config/order',
				component: () => import('@/components/ConfigurationManagement/MultiplexRouting'),
				name: 'configOrder',
				meta: {
					perms: ['GET /admin/config/order', 'POST /admin/config/order'],
					title: '订单配置',
					noCache: true
				}
			},
			{
				path: '/config/wx',
				component: () => import('@/components/ConfigurationManagement/MultiplexRouting'),
				name: 'configWx',
				meta: {
					perms: ['GET /admin/config/wx', 'POST /admin/config/wx'],
					title: '小程序配置',
					noCache: true
				}
			}
		]
	},

	{
		path: '/stat',
		component: layout,
		redirect: 'noredirect',
		alwaysShow: true,
		name: 'statManage',
		meta: {
			title: '统计报表',
			icon: 'chart'
		},
		children: [{
				path: '/stat/user',
				component: () => import('@/components/StatisticalReport/MultiplexRouting'),
				name: 'statUser',
				meta: {
					perms: ['GET /admin/stat/user'],
					title: '用户统计',
					noCache: true
				}
			},
			{
				path: '/stat/order',
				component: () => import('@/components/StatisticalReport/MultiplexRouting'),
				name: 'statOrder',
				meta: {
					perms: ['GET /admin/stat/order'],
					title: '订单统计',
					noCache: true
				}
			},
			{
				path: '/stat/goods',
				component: () => import('@/components/StatisticalReport/MultiplexRouting'),
				name: 'statGoods',
				meta: {
					perms: ['GET /admin/stat/goods'],
					title: '商品统计',
					noCache: true
				}
			}
		]
	},
	{
		path: 'external-link',
		component: layout,
		redirect: 'noredirect',
		alwaysShow: true,
		name: 'externalLink',
		meta: {
			title: '外链',
			icon: 'link'
		},
		children: [{
				path: 'https://cloud.tencent.com/product/cos',
				meta: {
					title: '腾讯云存储',
					icon: 'link'
				}
			},
			{
				path: 'https://cloud.tencent.com/product/sms',
				meta: {
					title: '腾讯云短信',
					icon: 'link'
				}
			},
			{
				path: 'https://pay.weixin.qq.com/index.php/core/home/login',
				meta: {
					title: '微信支付',
					icon: 'link'
				}
			},
			{
				path: 'https://mpkf.weixin.qq.com/',
				meta: {
					title: '小程序客服',
					icon: 'link'
				}
			},
			{
				path: 'https://www.alibabacloud.com/zh/product/oss',
				meta: {
					title: '阿里云存储',
					icon: 'link'
				}
			},
			{
				path: 'https://www.qiniu.com/products/kodo',
				meta: {
					title: '七牛云存储',
					icon: 'link'
				}
			},
			{
				path: 'http://www.kdniao.com/api-track',
				meta: {
					title: '快递鸟',
					icon: 'link'
				}
			}
		]
	},
]



export default new VueRouter({
	mode: "history",
	base: process.env.BASE_URL,
	routes: fixedRouter
})















// import Vue from "vue";
// import VueRouter from "vue-router";
// import Login from "../components/Login.vue";

// import UserManagement from "../components/UserManagement/MultiplexRouting.vue" //用户管理复用

// import MultiplexRouting from "../components/MultiplexRouting/MultiplexRouting.vue" //商场管理复用

// import CommodityCategory from "../components/MallManagement/CommodityCategory.vue" //商品类目
// import OrderManagement from "../components/MallManagement/OrderManagement.vue" //订单管理

// import CommodityManagement from "../components/CommodityManagement/MultiplexRouting.vue" //商品管理复用
// import ProductList from "../components/CommodityManagement/ProductList.vue" //商品列表
// import CommodityReview from "../components/CommodityManagement/CommodityReview.vue" //商品评论

// import AdvertisingManagement from "../components/PromotionManagement/AdvertisingManagement.vue"  //广告管理
// import CouponManagement from "../components/PromotionManagement/CouponManagement.vue" //优惠券管理
// import ThematicManagement from "../components/PromotionManagement/ThematicManagement.vue" //专题管理
// import PromotionManagement from "../components/PromotionManagement/MultiplexRouting.vue" //推广管理复用

// import Administrators from "../components/SystemManagement/Administrators.vue" //管理员
// import NotificatioManagement from "../components/SystemManagement/NotificatioManagement.vue" //通知管理
// import RoleManagement from "../components/SystemManagement/RoleManagement.vue" //角色管理
// import SystemManagement from "../components/SystemManagement/MultiplexRouting.vue" //系统管理复用

// import ConfigurationManagement from "../components/ConfigurationManagement/MultiplexRouting.vue" //配置管理复用

// import StatisticalReport from "../components/StatisticalReport/MultiplexRouting.vue" //统计报表复用

// import OuterChain from "../components/OuterChain/MultiplexRouting.vue" //外链复用

// Vue.use(VueRouter);

// const routes = [{
// 		path: "/",
// 		name: "Login",
// 		component: Login,
// 		// redirect:"/index"
// 	},
// 	{
// 		path: "/index",
// 		name: "首页",
// 		// route level code-splitting
// 		// this generates a separate chunk (about.[hash].js) for this route
// 		// which is lazy-loaded when the route is visited.
// 		component: () =>
// 			import( /* webpackChunkName: "about" */ "../components/Index.vue"),
// 	},
// 	{ //用户管理
// 		path:"/UserManagement",
// 		name:"用户管理",
// 		component: () =>
// 			import( /* webpackChunkName: "about" */ "../components/Index.vue"),
// 		children:[
// 			{path:"MultiplexRouting",name:"用户管理复用路由",component: UserManagement}, //复用
// 		]
// 	},
// 	{  //商场管理
// 		path: "/MallManagement",
// 		name:"商场管理",
// 		component: () =>
// 			import( /* webpackChunkName: "about" */ "../components/Index.vue"),
// 		children: [
// 			{path: "MultiplexRouting",name: "商场管理复用路由",component: MultiplexRouting}, //复用
// 			{path: "CommodityCategory",name: "商品类目",component: CommodityCategory}, //商品类目
// 			{path:"OrderManagement",name:"订单管理",component:OrderManagement} //订单管理
// 		]
// 	},
// 	{ //商品管理
// 		path:"/CommodityManagement",
// 		name:"商品管理",
// 		component: () =>
// 			import( /* webpackChunkName: "about" */ "../components/Index.vue"),
// 		children:[
// 			{path:"ProductList",name:"商品列表",component:ProductList},  //商品列表
// 			{path:"CommodityReview",name:"商品评论",component:CommodityReview},  //商品评论
// 			{path:"MultiplexRouting",name:"商品管理复用路由",component:CommodityManagement} //商品管理复用
// 		]
// 	},
// 	{ //推广管理
// 		path:"/PromotionManagement",
// 		name:"推广管理",
// 		component: () =>
// 			import( /* webpackChunkName: "about" */ "../components/Index.vue"),
// 			children:[
// 				{path:"AdvertisingManagement",name:"广告管理",component:AdvertisingManagement} ,//广告管理
// 				{path:"CouponManagement",name:"优惠券管理",component:CouponManagement}, //优惠券管理
// 				{path:"ThematicManagement",name:"专题管理",component:ThematicManagement}, //专题管理
// 				{path:"MultiplexRouting",name:"推广管理复用路由",component:PromotionManagement} //推广管理复用
// 			]
// 	},
// 	{ //系统管理
// 		path:"/SystemManagement",
// 		name:"系统管理",
// 		component: () =>
// 			import( /* webpackChunkName: "about" */ "../components/Index.vue"),
// 			children:[
// 				{path:"Administrators",name:"管理员",component:Administrators}, //管理员
// 				{path:"NotificatioManagement",name:"通知管理",component:NotificatioManagement}, //通知管理
// 				{path:"RoleManagement",name:"角色管理",component:RoleManagement}, //角色管理
// 				{path:"MultiplexRouting",name:"系统管理复用路由",component:SystemManagement} //系统管理复用
// 			]
// 	},
// 	{ //配置管理
// 		path:"/ConfigurationManagement",
// 		name:"配置管理",
// 		component: () =>
// 			import( /* webpackChunkName: "about" */ "../components/Index.vue"),
// 		children:[
// 			{path:"MultiplexRouting",name:"配置管理复用路由",component:ConfigurationManagement} //配置管理复用
// 		]
// 	},
// 	{ //统计报表
// 		path:"/StatisticalReport",
// 		name:"统计报表",
// 		component: () =>
// 			import( /* webpackChunkName: "about" */ "../components/Index.vue"),
// 		children:[
// 			{path:"MultiplexRouting",name:"统计报表复用路由",component:StatisticalReport} //统计报表复用
// 		]
// 	},
// 	{  //外链
// 		path:"/OuterChain",
// 		name:"外链",
// 		component: () =>
// 			import( /* webpackChunkName: "about" */ "../components/Index.vue"),
// 		children:[
// 			{path:"MultiplexRouting",name:"外链复用路由",component:OuterChain}  //外链复用
// 		]
// 	}
// ];

// const router = new VueRouter({
// 	mode: "history",
// 	base: process.env.BASE_URL,
// 	routes,

// });

// export default router;
